package ch.ffhs.activities;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MenuItem;
import android.webkit.WebView;

/**
 * class HelpActivity. Shows up an WebView with help.html.
 * 
 * @author mf
 * @author td
 */
public class HelpActivity extends Activity {

	@SuppressLint("SetJavaScriptEnabled")
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_help);

		getActionBar().setDisplayHomeAsUpEnabled(true);

		final WebView view = (WebView) findViewById(R.id.webview);
		view.getSettings().setJavaScriptEnabled(true);
		initializeWebKit(view, this);
		view.bringToFront();
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		// Respond to the action bar's Up/Home button
		case android.R.id.home:
			finish();
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

	private void initializeWebKit(WebView view, Context context) {
		view.loadUrl("file:///android_asset/help.html");
	}
}
